ReadWriteList Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Creates a read-write IList<T> wrapper around an array. When an array is implicitely converted to an IList<T>, changes to the items in the array cannot be made through the interface. This method creates a read-write IList<T> wrapper on an array that can be used to make changes to the array.

Use this method when you need to pass an array to an algorithms that takes an IList<T> and that tries to modify items in the list. Algorithms in this class generally do not need this method, since they have been design to operate on arrays even when they are passed as an IList<T>.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static IList<T> ReadWriteList<T>(
	T[] array
)
Visual Basic (Declaration)
Public Shared Function ReadWriteList(Of T) ( _
	array As T() _
) As IList(Of T)
Visual C++
public:
generic<typename T>
static IList<T>^ ReadWriteList (
	array<T>^ array
)

Parameters

array
array<T>[]()
The array to wrap.

Return Value

An IList<T> wrapper onto array.

Type Parameters

T

Remarks

Since arrays cannot be resized, inserting an item causes the last item in the array to be automatically removed. Removing an item causes the last item in the array to be replaced with a default value (0 or null). Clearing the list causes all the items to be replaced with a default value.

See Also